export default {
  namespace: "menu",
  state: {
    login: false,
    loading: true,
    fetching: false,
    selectIndex:0,
    menuCategoryList: [
      { text: "菜单0", data: [{ text: "产品0",price:23.2 }, { text: "产品0",price:32.1 }] },
      {
        text: "菜单1",
        data: [{ text: "产品",price:42.3 }, { text: "产品1",price:15.8 }, { text: "产品1",price:45.4 }]
      },
      { text: "菜单2", data: [{ text: "产品2",price:26.9 },{ text: "产品2",price:35.4 }, { text: "产品2",price:26.8 }] },
      { text: "菜单3", data: [{ text: "产品3",price:24.6 }] },
      { text: "菜单4", data: [{ text: "产品4",price:23.6 },{ text: "产品4",price:38.4 }, { text: "产品4",price:27.4 }] },
      { text: "菜单5", data: [{ text: "产品5",price:29.3 },{ text: "产品5",price:16.7 }, { text: "产品5",price:14.3}] },
      {text:'菜单6',data:[]}
    ]
  },
 
  reducers: {
    updateState(state, { payload }) {
      return { ...state, ...payload };
    }
  },
  effects: {
    *loadStorage(action, { call, put }) {
      const login = yield call(Storage.get, "login", false);
      yield put({
        type: "updateState",
        payload: {
          login,
          fetching: false
        }
      });
    }
  }
};
